package com.yuwei.mine.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.yuwei.database.entity.OrderEntity
import com.yuwei.image.glide.GlideImageLoader
import com.yuwei.mine.R

class OrderMultiAdapter: BaseMultiItemQuickAdapter<OrderEntity, BaseViewHolder>() {
    init {
        addItemType(1, R.layout.item_order_un_pay)
        addItemType(2, R.layout.item_order_not_shipped)
    }

    override fun convert(holder: BaseViewHolder, item: OrderEntity) {
        val image = holder.getView<ImageView>(R.id.item_order_goods_image)
        GlideImageLoader.loadImage(context,image,item.goods_default_icon)
        holder.setText(R.id.item_order_goods_desc,item.goods_desc)
        holder.setText(R.id.item_order_goods_price,"￥${item.goods_default_price}.00")
        holder.setText(R.id.item_order_goods_count,"x${item.count}")
        holder.setText(R.id.item_total_price,"合计￥${item.goods_default_price * item.count}.00")

    }
}